<template>
    <section>
        <el-tabs type="border-card" v-model="tab">
            <el-tab-pane label="部位" name="position">
                <base-position ref="position" :nodeActions="nodeActions"></base-position>
            </el-tab-pane>
            <el-tab-pane label="基码" name="codons">
                <base-codons ref="codons" :nodeActions="nodeActions"></base-codons>
            </el-tab-pane>
            <el-tab-pane label="方案" name="plan">
                <base-plan ref="plan" :nodeActions="nodeActions"></base-plan>
            </el-tab-pane>
        </el-tabs>
    </section>
</template>

<script>
import basePosition from "@/view/bs/components/basePosition";
import baseCodons from "@/view/bs/components/baseCodons";
import basePlan from "@/view/bs/components/basePlan";
export default {
    name: "bs_base",
    components: {
        basePosition,
        baseCodons,
        basePlan
    },
    watch:{
        tab(value){
            if(!this.$refs[value].isLoad){
                this.$refs[value].isLoad = true;
                this.$refs[value].searchBtn();
            }
        }
    },
    data() {
        return {
            tab: 'position',
            user: {},
            nodeActions: [],
        }
    },
    created() {
        this.user = this.$store.getters.user;
        this.nodeActions = this.user.node_actions[this.$route.meta.id] ? this.user.node_actions[this.$route.meta.id] : [];
    },
    mounted() {
        this.$refs[this.tab].isLoad = true;
        this.$refs[this.tab].searchBtn();
    }
}
</script>

<style scoped>

</style>
